<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>project-day04</title><link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}:root { --node-fill: #ECECFF; --node-border: #CCCCFF; --cluster-fill: #ffffde; --cluster-border: #aaaa33; --note-fill: #fff5ad; --note-border: #aaaa33; --mermaid-color: var(--text-color); }


:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; --title-bar-height:20px; }
.mac-os-11 { --title-bar-height:28px; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; tab-size: 4; }
iframe { margin: auto; }
a.url { word-break: break-all; }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 36px; }
#write.first-line-indent p { text-indent: 2em; }
#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0px; }
#write.first-line-indent li { margin-left: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap; }
.typora-export .task-list-item input { pointer-events: none; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  #write { padding-left: 20px; padding-right: 20px; }
  .CodeMirror-sizer { margin-left: 0px !important; }
  .CodeMirror-gutters { display: none !important; }
}
#write li > figure:last-child { margin-bottom: 0.5rem; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; image-orientation: from-image; }
button, input, select, textarea { color: inherit; font: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
p { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px; }
tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li blockquote { margin: 1rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures; }
  #write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  .typora-export #write { break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  .is-mac table { break-inside: avoid; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
#write.first-line-indent p > .md-image:only-child:not(.md-img-error) img { left: -2em; position: relative; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
.MathJax_ref { fill: currentcolor; }
[contenteditable="true"]:active, [contenteditable="true"]:focus, [contenteditable="false"]:active, [contenteditable="false"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.html-for-mac .inline-math-svg .MathJax_SVG { vertical-align: 0.2px; }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; overflow-y: hidden; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: var(--monospace); }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none 0s ease 0s; }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important; margin-top: 0px !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; height: auto; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }
mark { background: rgb(255, 255, 0); color: rgb(0, 0, 0); }
.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit; }
mark .md-meta { color: rgb(0, 0, 0); opacity: 0.3 !important; }
@media print {
  .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid; }
}
.md-diagram-panel .messageText { stroke: none !important; }
.md-diagram-panel .start-state { fill: var(--node-fill); }
.md-diagram-panel .edgeLabel rect { opacity: 1 !important; }
.md-require-zoom-fix foreignobject { font-size: var(--mermaid-font-zoom); }


.CodeMirror { height: auto; }
.CodeMirror.cm-s-inner { background: inherit; }
.CodeMirror-scroll { overflow: auto hidden; z-index: 3; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: red; }
.cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; box-sizing: content-box; background: inherit; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; overflow-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { overflow-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}


:root {
    --side-bar-bg-color: #fafafa;
    --control-text-color: #777;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);

/* open-sans-regular - latin-ext_latin */
  /* open-sans-italic - latin-ext_latin */
    /* open-sans-700 - latin-ext_latin */
    /* open-sans-700italic - latin-ext_latin */
  html {
    font-size: 16px;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: rgb(51, 51, 51);
    line-height: 1.6;
}

#write {
    max-width: 860px;
  	margin: 0 auto;
  	padding: 30px;
    padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
	#write {
		max-width: 1024px;
	}
}

@media only screen and (min-width: 1800px) {
	#write {
		max-width: 1200px;
	}
}

#write > ul:first-child,
#write > ol:first-child{
    margin-top: 30px;
}

a {
    color: #4183C4;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
    text-decoration: none;
}
h1 tt,
h1 code {
    font-size: inherit;
}
h2 tt,
h2 code {
    font-size: inherit;
}
h3 tt,
h3 code {
    font-size: inherit;
}
h4 tt,
h4 code {
    font-size: inherit;
}
h5 tt,
h5 code {
    font-size: inherit;
}
h6 tt,
h6 code {
    font-size: inherit;
}
h1 {
    font-size: 2.25em;
    line-height: 1.2;
    border-bottom: 1px solid #eee;
}
h2 {
    font-size: 1.75em;
    line-height: 1.225;
    border-bottom: 1px solid #eee;
}

/*@media print {
    .typora-export h1,
    .typora-export h2 {
        border-bottom: none;
        padding-bottom: initial;
    }

    .typora-export h1::after,
    .typora-export h2::after {
        content: "";
        display: block;
        height: 100px;
        margin-top: -96px;
        border-top: 1px solid #eee;
    }
}*/

h3 {
    font-size: 1.5em;
    line-height: 1.43;
}
h4 {
    font-size: 1.25em;
}
h5 {
    font-size: 1em;
}
h6 {
   font-size: 1em;
    color: #777;
}
p,
blockquote,
ul,
ol,
dl,
table{
    margin: 0.8em 0;
}
li>ol,
li>ul {
    margin: 0 0;
}
hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
}

li p.first {
    display: inline-block;
}
ul,
ol {
    padding-left: 30px;
}
ul:first-child,
ol:first-child {
    margin-top: 0;
}
ul:last-child,
ol:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 15px;
    color: #777777;
}
blockquote blockquote {
    padding-right: 0;
}
table {
    padding: 0;
    word-break: initial;
}
table tr {
    border-top: 1px solid #dfe2e5;
    margin: 0;
    padding: 0;
}
table tr:nth-child(2n),
thead {
    background-color: #f8f8f8;
}
table th {
    font-weight: bold;
    border: 1px solid #dfe2e5;
    border-bottom: 0;
    margin: 0;
    padding: 6px 13px;
}
table td {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 6px 13px;
}
table th:first-child,
table td:first-child {
    margin-top: 0;
}
table th:last-child,
table td:last-child {
    margin-bottom: 0;
}

.CodeMirror-lines {
    padding-left: 4px;
}

.code-tooltip {
    box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
    border-top: 1px solid #eef2f2;
}

.md-fences,
code,
tt {
    border: 1px solid #e7eaed;
    background-color: #f8f8f8;
    border-radius: 3px;
    padding: 0;
    padding: 2px 4px 0px 4px;
    font-size: 0.9em;
}

code {
    background-color: #f3f4f4;
    padding: 0 2px 0 2px;
}

.md-fences {
    margin-bottom: 15px;
    margin-top: 15px;
    padding-top: 8px;
    padding-bottom: 6px;
}


.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
    html {
        font-size: 13px;
    }
    table,
    pre {
        page-break-inside: avoid;
    }
    pre {
        word-wrap: break-word;
    }
}

.md-fences {
	background-color: #f8f8f8;
}
#write pre.md-meta-block {
	padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f7f7f7;
    border: 0;
    border-radius: 3px;
    color: #777777;
    margin-top: 0 !important;
}

.mathjax-block>.code-tooltip {
	bottom: .375rem;
}

.md-mathjax-midline {
    background: #fafafa;
}

#write>h3.md-focus:before{
	left: -1.5625rem;
	top: .375rem;
}
#write>h4.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h5.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h6.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
.md-image>.md-meta {
    /*border: 1px solid #ddd;*/
    border-radius: 3px;
    padding: 2px 0px 0px 4px;
    font-size: 0.9em;
    color: inherit;
}

.md-tag {
    color: #a7a7a7;
    opacity: 1;
}

.md-toc { 
    margin-top:20px;
    padding-bottom:20px;
}

.sidebar-tabs {
    border-bottom: none;
}

#typora-quick-open {
    border: 1px solid #ddd;
    background-color: #f8f8f8;
}

#typora-quick-open-item {
    background-color: #FAFAFA;
    border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
    border-style: solid;
    border-width: 1px;
}

/** focus mode */
.on-focus-mode blockquote {
    border-left-color: rgba(85, 85, 85, 0.12);
}

header, .context-menu, .megamenu-content, footer{
    font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state{
    visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
    background-color: #fafafa;
    background-color: var(--side-bar-bg-color);
}

.md-lang {
    color: #b4654d;
}

.html-for-mac .context-menu {
    --item-hover-bg-color: #E6F0FE;
}

#md-notification .btn {
    border: 0;
}

.dropdown-menu .divider {
    border-color: #e5e5e5;
}

.ty-preferences .window-content {
    background-color: #fafafa;
}

.ty-preferences .nav-group-item.active {
    color: white;
    background: #999;
}

 :root {--mermaid-font-zoom:1.44em ;} 
</style>
</head>
<body class='typora-export os-windows'>
<div id='write'  class=''><div class='md-toc' mdtype='toc'><p class="md-toc-content" role="list"><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n4"><a class="md-toc-inner" href="#一项目完整拓扑">一、项目完整拓扑</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n5"><a class="md-toc-inner" href="#1完整拓扑">1、完整拓扑</a></span><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n9"><a class="md-toc-inner" href="#二编写资源文件">二、编写资源文件</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n10"><a class="md-toc-inner" href="#1创建nginxphpfilebeat容器">1、创建nginx，php，filebeat容器</a></span><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n15"><a class="md-toc-inner" href="#三动态集群hpa搭建">三、动态集群HPA搭建</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n16"><a class="md-toc-inner" href="#1安装metrics-server插件">1、安装metrics-server插件</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n21"><a class="md-toc-inner" href="#2nginxtomcat配置">2、nginx+tomcat配置</a></span><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n23"><a class="md-toc-inner" href="#四ingress发布服务">四、ingress发布服务</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n24"><a class="md-toc-inner" href="#1配置ingress服务">1、配置ingress服务</a></span><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n36"><a class="md-toc-inner" href="#五收集日志">五、收集日志</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n37"><a class="md-toc-inner" href="#1把数据写入到es集群">1、把数据写入到ES集群</a></span><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n45"><a class="md-toc-inner" href="#六kibana数据展示">六、kibana数据展示</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n46"><a class="md-toc-inner" href="#1数据展示">1、数据展示</a></span></p></div><p>&nbsp;</p><p>&nbsp;</p><h1><a name="一项目完整拓扑" class="md-header-anchor"></a><span>一、项目完整拓扑</span></h1><h4><a name="1完整拓扑" class="md-header-anchor"></a><span>1、完整拓扑</span></h4><p><span>使用 Nginx 搭建 web 集群，动态页面由 PHP 和 Tomcat 集群解析</span>
<span>使用 NFS 存放网页，将访问日志存放在计算节点的 /var/weblog 目录下</span>
<span>弹性部署 PHP、Tomcat 集群服务</span></p><p><span>使用ELK集群收集k8s容器日志，进行分析</span></p><div class="md-diagram-panel"><svg id="mermaidChart0" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="1144.16259765625" style="max-width: 1583.1px; height: 1184.16px;" viewBox="0 0 1583.10498046875 1144.16259765625" class="md-require-zoom-fix"><style>#mermaidChart0{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;fill:#333333;}#mermaidChart0 .error-icon{fill:hsl(60,100%,100%);}#mermaidChart0 .error-text{fill:rgb(0,0,0);stroke:rgb(0,0,0);}#mermaidChart0 .edge-thickness-normal{stroke-width:2px;}#mermaidChart0 .edge-thickness-thick{stroke-width:3.5px;}#mermaidChart0 .edge-pattern-solid{stroke-dasharray:0;}#mermaidChart0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaidChart0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaidChart0 .marker{fill:#000000;}#mermaidChart0 .marker.cross{stroke:#000000;}#mermaidChart0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;}#mermaidChart0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaidChart0 .label text{fill:#333;}#mermaidChart0 .node rect,#mermaidChart0 .node circle,#mermaidChart0 .node ellipse,#mermaidChart0 .node polygon,#mermaidChart0 .node path{fill:#ECECFF;stroke:hsl(240,60%,86.2745098039%);stroke-width:1px;}#mermaidChart0 .node .label{text-align:center;}#mermaidChart0 .node.clickable{cursor:pointer;}#mermaidChart0 .arrowheadPath{fill:undefined;}#mermaidChart0 .edgePath .path{stroke:#000000;stroke-width:1.5px;}#mermaidChart0 .flowchart-link{stroke:#000000;fill:none;}#mermaidChart0 .edgeLabel{background-color:#f4f4f4;text-align:center;}#mermaidChart0 .edgeLabel rect{opacity:0.5;background-color:#f4f4f4;fill:#f4f4f4;}#mermaidChart0 .cluster rect{fill:hsl(60,100%,100%);stroke:hsl(60,60%,90%);stroke-width:1px;}#mermaidChart0 .cluster text{fill:rgb(0,0,0);}#mermaidChart0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(60,100%,100%);border:1px solid undefined;border-radius:2px;pointer-events:none;z-index:100;}#mermaidChart0:root{--mermaid-font-family:sans-serif;}#mermaidChart0:root{--mermaid-alt-font-family:sans-serif;}#mermaidChart0 .I &gt; *{fill:#009000 !important;color:#ffffff !important;stroke:#f06080 !important;stroke-width:3px !important;}#mermaidChart0 .I tspan{fill:#ffffff !important;}#mermaidChart0 .NFS &gt; *{fill:#ccf !important;stroke:#f66 !important;stroke-width:3px !important;stroke-dasharray:0 !important;0 !important;}#mermaidChart0 .NFS tspan{!important;}#mermaidChart0 .User &gt; *{fill:#ccddee !important;color:#000000 !important;stroke:#555555 !important;stroke-width:3px !important;}#mermaidChart0 .User tspan{fill:#000000 !important;}#mermaidChart0 .S &gt; *{fill:#ffaa00 !important;color:#3333ff !important;stroke:#303030 !important;stroke-width:3px !important;}#mermaidChart0 .S tspan{fill:#3333ff !important;}#mermaidChart0 .Pod &gt; *{fill:#ccffbb !important;color:#000000 !important;stroke-width:3px !important;stroke-dasharray:0 !important;0 !important;}#mermaidChart0 .Pod tspan{fill:#000000 !important;}#mermaidChart0 .vPod &gt; *{fill:#aaeeaa !important;color:#000000 !important;stroke-width:3px !important;stroke:#f00000 !important;stroke-dasharray:10 !important;0 !important;}#mermaidChart0 .vPod tspan{fill:#000000 !important;}#mermaidChart0 .Kubernetes &gt; *{fill:#ffffc0 !important;color:#ff00ff !important;stroke-width:4px !important;}#mermaidChart0 .Kubernetes tspan{fill:#ff00ff !important;}#mermaidChart0 .ZONE &gt; *{fill:#ffffc0 !important;color:#ff00ff !important;}#mermaidChart0 .ZONE tspan{fill:#ff00ff !important;}#mermaidChart0 flowchart-v2{fill:apa;}</style><g transform="translate(0, 2)"><marker id="flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="9" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><g class="root"><g class="clusters"><g class="cluster ZONE" id="Z3"><rect rx="0" ry="0" x="1294.632453918457" y="8" width="168.3574981689453" height="288.43994140625"></rect><g class="cluster-label" transform="translate(1342.867446899414, 6)"><foreignObject width="71.88751220703125" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>ES Cluster</span></div></foreignObject></g></g><g class="cluster ZONE" id="Z2"><rect rx="0" ry="0" x="725.5874862670898" y="15.3699951171875" width="469.0449676513672" height="246.3299560546875"></rect><g class="cluster-label" transform="translate(929.5212173461914, 13.3699951171875)"><foreignObject width="61.17750549316406" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Logstash</span></div></foreignObject></g></g><g class="cluster Kubernetes" id="K"><rect rx="0" ry="0" x="115.66000366210938" y="281.699951171875" width="892.6874465942383" height="852.4626045227051"></rect><g class="cluster-label" transform="translate(521.8412208557129, 279.699951171875)"><foreignObject width="80.32501220703125" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Kubernetes</span></div></foreignObject></g></g></g><g class="edgePaths"><path d="M184.22124410435643,636.6643505096436L193.47770377633546,608.60174036026C202.73416344831443,580.5391302108765,221.24708279227244,524.4139099121094,236.69708367315445,496.35129976272583C252.14708455403647,468.2886896133423,264.53416697184247,468.2886896133423,270.7277081807454,468.2886896133423L276.92124938964844,468.2886896133423" id="L-I-WS1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-I LE-WS1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M184.39677684008046,676.1443309783936L193.62398105610546,703.3839120864868C202.85118527213046,730.6234931945801,221.3055937041805,785.1026554107666,234.69946458687215,812.3422365188599C248.0933354695638,839.5818176269531,256.42666880289715,839.5818176269531,260.5933354695638,839.5818176269531L264.76000213623047,839.5818176269531" id="L-I-WS2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-I LE-WS2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M359.8462675911324,436.3087091445923L369.1402218227698,427.06714391708374C378.43417605440726,417.8255786895752,397.0220845176821,399.3424482345581,410.48270541598623,390.10088300704956C423.94332631429035,380.859317779541,432.2766596476237,380.859317779541,440.60999298095703,380.859317779541C448.94332631429035,380.859317779541,457.2766596476237,380.859317779541,465.60999298095703,380.859317779541C473.94332631429035,380.859317779541,482.2766596476237,380.859317779541,486.44332631429035,380.859317779541L490.60999298095703,380.859317779541" id="L-WS1-WEB1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WS1 LE-WEB1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M349.7805669009983,500.2686700820923L360.75213791432475,516.1483526229858C371.7237089276512,532.0280351638794,393.66685095430415,563.7874002456665,408.8050886342973,579.6670827865601C423.94332631429035,595.5467653274536,432.2766596476237,595.5467653274536,440.60999298095703,595.5467653274536C448.94332631429035,595.5467653274536,457.2766596476237,595.5467653274536,465.60999298095703,595.5467653274536C473.94332631429035,595.5467653274536,482.2766596476237,595.5467653274536,486.44332631429035,595.5467653274536L490.60999298095703,595.5467653274536" id="L-WS1-WEB2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WS1 LE-WEB2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M533.5145451455169,410.1955274387043L539.3792029146397,421.54438780114396C545.2438606837626,432.8932481635836,556.9731762220082,455.5909688884629,570.5186307874129,479.3094152418084C584.0640853528175,503.0278615951538,599.4256789453813,527.7670335769653,607.1064757416631,540.1366195678711L614.7872725379449,552.5062055587769" id="L-WEB1-PS1" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB1 LE-PS1" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-end="url(#flowchart-pointEnd)"></path><path d="M543.7024917602539,610.7952360225754L547.8691584269205,613.188617235508C552.0358250935873,615.5819984484406,560.3691584269205,620.3687608743057,568.7381172180176,620.1704228948357C577.1070760091146,619.9720849153658,585.5116602579752,614.7886465305609,589.7139523824056,612.1969273381583L593.9162445068359,609.6052081457558" id="L-WEB2-PS1" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB2 LE-PS1" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-end="url(#flowchart-pointEnd)"></path><path d="M358.4064493557287,807.6018371582031L367.94037329326676,797.6773484547933C377.4742972308048,787.7528597513834,396.54214510588093,767.9038823445638,410.2427357100857,757.9793936411539C423.94332631429035,748.0549049377441,432.2766596476237,748.0549049377441,440.60999298095703,748.0549049377441C448.94332631429035,748.0549049377441,457.2766596476237,748.0549049377441,465.60999298095703,748.0549049377441C473.94332631429035,748.0549049377441,482.2766596476237,748.0549049377441,486.44332631429035,748.0549049377441L490.60999298095703,748.0549049377441" id="L-WS2-WEB3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WS2 LE-WEB3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M345.30703349038106,871.5617980957031L357.02419340547704,892.8257738749186C368.74135332057307,914.0897496541342,392.175673150765,956.6177012125651,408.0594997325277,977.8816769917806C423.94332631429035,999.1456527709961,432.2766596476237,999.1456527709961,440.60999298095703,999.1456527709961C448.94332631429035,999.1456527709961,457.2766596476237,999.1456527709961,465.60999298095703,999.1456527709961C473.94332631429035,999.1456527709961,482.2766596476237,999.1456527709961,486.44332631429035,999.1456527709961L490.60999298095703,999.1456527709961" id="L-WS2-WEB4" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WS2 LE-WEB4" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M531.1421197045412,777.856056833363L537.4021817138266,791.8819187880362C543.662243723112,805.9077807427092,556.1823677416829,833.9595046520553,570.0301343515447,859.870723191913C583.8779009614062,885.7819417317709,599.0533101625587,909.5526549021403,606.6410147631349,921.4380114873251L614.228719363711,933.3233680725098" id="L-WEB3-PS2" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB3 LE-PS2" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-end="url(#flowchart-pointEnd)"></path><path d="M543.7024917602539,1017.0289338127601L547.8691584269205,1019.8358716183096C552.0358250935873,1022.642809423859,560.3691584269205,1028.256685034958,570.4002738770251,1024.9657509011665C580.4313893271296,1021.6748167673746,592.1602868940053,1009.4790728886923,598.0247356774431,1003.381200949351L603.889184460881,997.2833290100098" id="L-WEB4-PS2" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB4 LE-PS2" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-end="url(#flowchart-pointEnd)"></path><path d="M649.8829595692424,552.5062055587769L658.3337140188836,534.7705785433451C666.7844684685249,517.0349515279134,683.6859773678074,481.56369749705,696.3033984841153,463.8280704816182C708.9208196004232,446.0924434661865,717.2541529337565,446.0924434661865,733.236234664917,446.0924434661865C749.2183163960775,446.0924434661865,772.8491465250651,446.0924434661865,796.4799766540527,446.0924434661865C820.1108067830404,446.0924434661865,843.741636912028,446.0924434661865,863.6943422953287,446.0924434661865C883.6470476786295,446.0924434661865,899.9216283162435,446.0924434661865,908.0589186350504,446.0924434661865L916.1962089538574,446.0924434661865" id="L-PS1-PHP1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS1 LE-PHP1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M675.3737335205078,566.198623547126L679.5760256449381,564.3117576317399C683.7783177693685,562.4248917163538,692.1829020182291,558.6511598855817,700.5518608093262,556.7642939701956C708.9208196004232,554.8774280548096,717.2541529337565,554.8774280548096,733.236234664917,554.8774280548096C749.2183163960775,554.8774280548096,772.8491465250651,554.8774280548096,796.4799766540527,554.8774280548096C820.1108067830404,554.8774280548096,843.741636912028,554.8774280548096,863.6943422953287,554.8774280548096C883.6470476786295,554.8774280548096,899.9216283162435,554.8774280548096,908.0589186350504,554.8774280548096L916.1962089538574,554.8774280548096" id="L-PS1-PHP2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS1 LE-PHP2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M661.2797487687075,616.4661664962769L667.8310383517712,624.3322075208029C674.382327934835,632.1982485453287,687.4849071009625,647.9303305943807,698.2028633506928,655.7963716189066C708.9208196004232,663.6624126434326,717.2541529337565,663.6624126434326,733.236234664917,663.6624126434326C749.2183163960775,663.6624126434326,772.8491465250651,663.6624126434326,796.4799766540527,663.6624126434326C820.1108067830404,663.6624126434326,843.741636912028,663.6624126434326,863.6943422953287,663.6624126434326C883.6470476786295,663.6624126434326,899.9216283162435,663.6624126434326,908.0589186350504,663.6624126434326L916.1962089538574,663.6624126434326" id="L-PS1-PHP3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS1 LE-PHP3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M648.7449201380236,933.3233680725098L657.3853478262014,913.7260589599609C666.025775514379,894.1287498474121,683.3066308907345,854.9341316223145,696.1137252455788,835.3368225097656C708.9208196004232,815.7395133972168,717.2541529337565,815.7395133972168,733.236234664917,815.7395133972168C749.2183163960775,815.7395133972168,772.8491465250651,815.7395133972168,796.4799766540527,815.7395133972168C820.1108067830404,815.7395133972168,843.741636912028,815.7395133972168,861.8137168884277,815.7395133972168C879.8857968648275,815.7395133972168,892.3991266886393,815.7395133972168,898.6557916005453,815.7395133972168L904.9124565124512,815.7395133972168" id="L-PS2-TM1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS2 LE-TM1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M675.5874862670898,944.0725319802419L679.7541529337565,941.911898369562C683.9208196004232,939.7512647588819,692.2541529337565,935.429997537522,700.5874862670898,933.2693639268422C708.9208196004232,931.1087303161621,717.2541529337565,931.1087303161621,733.236234664917,931.1087303161621C749.2183163960775,931.1087303161621,772.8491465250651,931.1087303161621,796.4799766540527,931.1087303161621C820.1108067830404,931.1087303161621,843.741636912028,931.1087303161621,861.8137168884277,931.1087303161621C879.8857968648275,931.1087303161621,892.3991266886393,931.1087303161621,898.6557916005453,931.1087303161621L904.9124565124512,931.1087303161621" id="L-PS2-TM2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS2 LE-TM2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M660.6240490664164,997.2833290100098L667.2846219331954,1005.482432047526C673.9451947999743,1013.6815350850424,687.266340533532,1030.079741160075,698.0935800669777,1038.278844197591C708.9208196004232,1046.4779472351074,717.2541529337565,1046.4779472351074,733.236234664917,1046.4779472351074C749.2183163960775,1046.4779472351074,772.8491465250651,1046.4779472351074,796.4799766540527,1046.4779472351074C820.1108067830404,1046.4779472351074,843.741636912028,1046.4779472351074,861.8137168884277,1046.4779472351074C879.8857968648275,1046.4779472351074,892.3991266886393,1046.4779472351074,898.6557916005453,1046.4779472351074L904.9124565124512,1046.4779472351074" id="L-PS2-TM3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-PS2 LE-TM3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M537.2900462642865,352.535477380406L542.5254538469477,344.06288967898416C547.760861429609,335.5903019775623,558.2316765949314,318.6451265747187,574.4575003864957,310.17253887329684C590.6833241780599,301.699951171875,612.6641565958658,301.699951171875,634.6449890136719,301.699951171875C656.6258214314779,301.699951171875,678.6066538492838,301.699951171875,693.7637367248535,301.699951171875C708.9208196004232,301.699951171875,717.2541529337565,301.699951171875,730.9969042721463,280.0155198358567C744.7396556105358,258.3310884998384,763.8918249539817,214.96222582780183,773.4679096257047,193.2777944917835L783.0439942974277,171.59336315576522" id="L-WEB1-A1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WEB1 LE-A1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M522.9762084291526,564.8086848772747L530.5972556510028,524.2905625930414C538.2183028728531,483.77244030880814,553.4603973165534,402.73619574034154,572.0718607473067,362.21807345610824C590.6833241780599,321.699951171875,612.6641565958658,321.699951171875,634.6449890136719,321.699951171875C656.6258214314779,321.699951171875,678.6066538492838,321.699951171875,693.7637367248535,321.699951171875C708.9208196004232,321.699951171875,717.2541529337565,321.699951171875,731.1801840142729,296.86546624465007C745.1062150947891,272.03098131742513,764.6249439224886,222.36201146297526,774.3843083363382,197.5275265357503L784.143672750188,172.69304160852536" id="L-WEB2-A1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WEB2 LE-A1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M521.0783778062794,717.2172986460947L529.0157301319418,654.6310740670581C536.9530824576042,592.0448494880214,552.8277871089291,466.8724003299482,571.7555556434945,404.2861757509116C590.6833241780599,341.699951171875,612.6641565958658,341.699951171875,634.6449890136719,341.699951171875C656.6258214314779,341.699951171875,678.6066538492838,341.699951171875,693.7637367248535,341.699951171875C708.9208196004232,341.699951171875,717.2541529337565,341.699951171875,731.3366543217097,313.68860321875354C745.4191557096628,285.6772552656321,765.2508251522358,229.65455935938914,775.1666598735222,201.64321140626768L785.0824945948087,173.6318634531462" id="L-WEB3-A1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WEB3 LE-A1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M519.6565010744112,968.259382061963L527.830832855385,867.1661435802816C536.0051646363587,766.0729050986005,552.3538281983064,563.8864281352377,571.5185761881831,462.79318965355634C590.6833241780599,361.699951171875,612.6641565958658,361.699951171875,634.6449890136719,361.699951171875C656.6258214314779,361.699951171875,678.6066538492838,361.699951171875,693.7637367248535,361.699951171875C708.9208196004232,361.699951171875,717.2541529337565,361.699951171875,731.4717966579411,330.49041222165175C745.689440382126,299.28087327142856,765.7913944971621,236.8617953709821,775.8423715546801,205.65225642075885L785.8933486121981,174.4427174705356" id="L-WEB4-A1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-WEB4 LE-A1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M842.8724670410155,139.6368551254273L846.9558003743488,139.55352179209396C851.0391337076823,139.47018845876062,859.205800374349,139.30352179209393,867.5391337076823,139.3035217920939C875.8724670410156,139.3035217920939,884.3724670410156,139.4701884587606,888.6224670410156,139.55352179209393L892.8724670410155,139.63685512542727" id="L-A1-A2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A1 LE-A2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M983.8474502563478,139.63685512542727L987.9307835896811,139.55352179209393C992.0141169230143,139.4701884587606,1000.180783589681,139.3035217920939,1008.430783589681,139.2201884587606C1016.680783589681,139.13685512542725,1025.0141169230144,139.13685512542725,1034.1914100646973,139.22018845876053C1043.3687032063801,139.30352179209385,1053.3899561564128,139.47018845876048,1058.400582631429,139.55352179209376L1063.4112091064453,139.63685512542708" id="L-A2-A3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A2 LE-A3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1140.71979311611,114.78795317317802L1149.7052365831678,106.11329268337751C1158.6906800502256,97.43863219357702,1176.6615669843413,80.08931121397602,1189.813677118066,71.4146507241755C1202.9657872517903,62.739990234375,1211.2991205851238,62.739990234375,1219.632453918457,62.739990234375C1227.9657872517903,62.739990234375,1236.2991205851238,62.739990234375,1244.632453918457,62.739990234375C1252.9657872517903,62.739990234375,1261.2991205851238,62.739990234375,1269.632453918457,62.739990234375C1277.9657872517903,62.739990234375,1286.2991205851238,62.739990234375,1294.632453918457,62.739990234375C1302.9657872517903,62.739990234375,1311.2991205851238,62.739990234375,1315.4657872517903,62.739990234375L1319.632453918457,62.739990234375" id="L-A3-ES1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A3 LE-ES1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1158.4386369640852,146.76691322970157L1164.4709397898139,147.67575614193882C1170.5032426155424,148.58459905417604,1182.5678482669998,150.40228487865053,1192.766817759395,151.31112779088775C1202.9657872517903,152.219970703125,1211.2991205851238,152.219970703125,1219.632453918457,152.219970703125C1227.9657872517903,152.219970703125,1236.2991205851238,152.219970703125,1244.632453918457,152.219970703125C1252.9657872517903,152.219970703125,1261.2991205851238,152.219970703125,1269.632453918457,152.219970703125C1277.9657872517903,152.219970703125,1286.2991205851238,152.219970703125,1294.632453918457,152.219970703125C1302.9657872517903,152.219970703125,1311.2991205851238,152.219970703125,1315.4657872517903,152.219970703125L1319.632453918457,152.219970703125" id="L-A3-ES2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A3 LE-ES2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1136.9735315854698,168.23201860831696L1146.583351974301,180.47667403557662C1156.1931723631321,192.72132946283628,1175.4128131407945,217.21064031735565,1189.1893001962924,229.45529574461534C1202.9657872517903,241.699951171875,1211.2991205851238,241.699951171875,1219.632453918457,241.699951171875C1227.9657872517903,241.699951171875,1236.2991205851238,241.699951171875,1244.632453918457,241.699951171875C1252.9657872517903,241.699951171875,1261.2991205851238,241.699951171875,1269.632453918457,241.699951171875C1277.9657872517903,241.699951171875,1286.2991205851238,241.699951171875,1294.632453918457,241.699951171875C1302.9657872517903,241.699951171875,1311.2991205851238,241.699951171875,1315.4657872517903,241.699951171875L1319.632453918457,241.699951171875" id="L-A3-ES3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A3 LE-ES3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1437.9899520874023,62.739990234375L1442.156618754069,62.739990234375C1446.3232854207356,62.739990234375,1454.656618754069,62.739990234375,1462.9899520874023,62.739990234375C1471.3232854207356,62.739990234375,1479.656618754069,62.739990234375,1488.1879185706582,68.4477653307307C1496.7192183872473,74.15554042708641,1505.448484687092,85.57109061979781,1509.8131178370147,91.27886571615352L1514.177750986937,96.98664081250922" id="L-ES1-kk" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-ES1 LE-kk" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1437.9899520874023,152.219970703125L1442.156618754069,152.219970703125C1446.3232854207356,152.219970703125,1454.656618754069,152.219970703125,1462.9899520874023,152.219970703125C1471.3232854207356,152.219970703125,1479.656618754069,152.219970703125,1487.9899520874023,150.05919735754637C1496.3232854207356,147.8984240119677,1504.656618754069,143.57687732081038,1508.8232854207356,141.41610397523175L1512.9899520874023,139.2553306296531" id="L-ES2-kk" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-ES2 LE-kk" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M1437.9899520874023,241.699951171875L1442.156618754069,241.699951171875C1446.3232854207356,241.699951171875,1454.656618754069,241.699951171875,1462.9899520874023,241.699951171875C1471.3232854207356,241.699951171875,1479.656618754069,241.699951171875,1490.6294376863043,227.1287870492936C1501.6022566185393,212.55762292671224,1515.2145611496762,183.41529468154943,1522.020713415245,168.84413055896803L1528.8268656808132,154.27296643638664" id="L-ES3-kk" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-ES3 LE-kk" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M543.7024917602539,381.29224285056756L547.8691584269205,381.3601942374521C552.0358250935873,381.42814562433676,560.3691584269205,381.56404839810585,575.5262413024902,381.63199978499046C590.6833241780599,381.699951171875,612.6641565958658,381.699951171875,634.6449890136719,381.699951171875C656.6258214314779,381.699951171875,678.6066538492838,381.699951171875,693.7637367248535,381.699951171875C708.9208196004232,381.699951171875,717.2541529337565,381.699951171875,733.236234664917,381.699951171875C749.2183163960775,381.699951171875,772.8491465250651,381.699951171875,796.4799766540527,381.699951171875C820.1108067830404,381.699951171875,843.741636912028,381.699951171875,867.3049672444662,381.699951171875C890.8682975769043,381.699951171875,914.364128112793,381.699951171875,937.8599586486816,381.699951171875C961.3557891845703,381.699951171875,984.851619720459,381.699951171875,1000.76620165507,381.699951171875C1016.680783589681,381.699951171875,1025.0141169230144,381.699951171875,1042.6212005615234,466.87933079401654C1060.2282842000325,552.0587104161581,1087.1091181437175,722.417469660441,1100.5495351155598,807.5968492825826L1113.9899520874023,892.7762289047241" id="L-WEB1-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB1 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M959.5237083435059,446.0924434661865L967.6609986623129,446.0924434661865C975.7982889811198,446.0924434661865,992.0728696187338,446.0924434661865,1004.3768266042074,446.0924434661865C1016.680783589681,446.0924434661865,1025.0141169230144,446.0924434661865,1042.6212005615234,520.5397410392761C1060.2282842000325,594.9870386123657,1087.1091181437175,743.8816337585449,1100.5495351155598,818.3289313316345L1113.9899520874023,892.7762289047241" id="L-PHP1-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-PHP1 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M959.5237083435059,554.8774280548096L967.6609986623129,554.8774280548096C975.7982889811198,554.8774280548096,992.0728696187338,554.8774280548096,1004.3768266042074,554.8774280548096C1016.680783589681,554.8774280548096,1025.0141169230144,554.8774280548096,1042.6212005615234,611.1938948631287C1060.2282842000325,667.5103616714478,1087.1091181437175,780.1432952880859,1100.5495351155598,836.459762096405L1113.9899520874023,892.7762289047241" id="L-PHP2-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-PHP2 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M959.5237083435059,663.6624126434326L967.6609986623129,663.6624126434326C975.7982889811198,663.6624126434326,992.0728696187338,663.6624126434326,1004.3768266042074,663.6624126434326C1016.680783589681,663.6624126434326,1025.0141169230144,663.6624126434326,1042.6212005615234,701.8480486869812C1060.2282842000325,740.0336847305298,1087.1091181437175,816.404956817627,1100.5495351155598,854.5905928611755L1113.9899520874023,892.7762289047241" id="L-PHP3-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-PHP3 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M529.1840254812438,625.6572682874303L535.7704365277455,642.7235410624826C542.3568475742471,659.7898138375349,555.5296696672505,693.9223593876395,573.1064969226552,710.9886321626918C590.6833241780599,728.0549049377441,612.6641565958658,728.0549049377441,634.6449890136719,728.0549049377441C656.6258214314779,728.0549049377441,678.6066538492838,728.0549049377441,693.7637367248535,728.0549049377441C708.9208196004232,728.0549049377441,717.2541529337565,728.0549049377441,733.236234664917,728.0549049377441C749.2183163960775,728.0549049377441,772.8491465250651,728.0549049377441,796.4799766540527,728.0549049377441C820.1108067830404,728.0549049377441,843.741636912028,728.0549049377441,867.3049672444662,728.0549049377441C890.8682975769043,728.0549049377441,914.364128112793,728.0549049377441,937.8599586486816,728.0549049377441C961.3557891845703,728.0549049377441,984.851619720459,728.0549049377441,1000.76620165507,728.0549049377441C1016.680783589681,728.0549049377441,1025.0141169230144,728.0549049377441,1042.6212005615234,755.5084589322408C1060.2282842000325,782.9620129267374,1087.1091181437175,837.8691209157308,1100.5495351155598,865.3226749102274L1113.9899520874023,892.7762289047241" id="L-WEB2-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB2 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M543.7024917602539,748.0549049377441L547.8691584269205,748.0549049377441C552.0358250935873,748.0549049377441,560.3691584269205,748.0549049377441,575.5262413024902,748.0549049377441C590.6833241780599,748.0549049377441,612.6641565958658,748.0549049377441,634.6449890136719,748.0549049377441C656.6258214314779,748.0549049377441,678.6066538492838,748.0549049377441,693.7637367248535,748.0549049377441C708.9208196004232,748.0549049377441,717.2541529337565,748.0549049377441,733.236234664917,748.0549049377441C749.2183163960775,748.0549049377441,772.8491465250651,748.0549049377441,796.4799766540527,748.0549049377441C820.1108067830404,748.0549049377441,843.741636912028,748.0549049377441,867.3049672444662,748.0549049377441C890.8682975769043,748.0549049377441,914.364128112793,748.0549049377441,937.8599586486816,748.0549049377441C961.3557891845703,748.0549049377441,984.851619720459,748.0549049377441,1000.76620165507,748.0549049377441C1016.680783589681,748.0549049377441,1025.0141169230144,748.0549049377441,1042.6212005615234,772.1751255989075C1060.2282842000325,796.2953462600708,1087.1091181437175,844.5357875823975,1100.5495351155598,868.6560082435608L1113.9899520874023,892.7762289047241" id="L-WEB3-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB3 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M970.8074607849121,815.7395133972168L977.064125696818,815.7395133972168C983.320790608724,815.7395133972168,995.8341204325358,815.7395133972168,1006.2574520111084,815.7395133972168C1016.680783589681,815.7395133972168,1025.0141169230144,815.7395133972168,1042.6212005615234,828.5789659818014C1060.2282842000325,841.4184185663859,1087.1091181437175,867.097323735555,1100.5495351155598,879.9367763201395L1113.9899520874023,892.7762289047241" id="L-TM1-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-TM1 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M970.8074607849121,931.1087303161621L977.064125696818,931.1087303161621C983.320790608724,931.1087303161621,995.8341204325358,931.1087303161621,1006.2574520111084,931.1087303161621C1016.680783589681,931.1087303161621,1025.0141169230144,931.1087303161621,1042.6212005615234,924.7199800809225C1060.2282842000325,918.3312298456827,1087.1091181437175,905.5537293752035,1100.5495351155598,899.1649791399637L1113.9899520874023,892.7762289047241" id="L-TM2-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-TM2 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M970.8074607849121,1046.4779472351074L977.064125696818,1046.4779472351074C983.320790608724,1046.4779472351074,995.8341204325358,1046.4779472351074,1006.2574520111084,1046.4779472351074C1016.680783589681,1046.4779472351074,1025.0141169230144,1046.4779472351074,1042.6212005615234,1020.8609941800436C1060.2282842000325,995.2440411249796,1087.1091181437175,944.0101350148519,1100.5495351155598,918.393181959788L1113.9899520874023,892.7762289047241" id="L-TM3-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-TM3 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M531.0131549035889,1028.9691051156844L537.2947110463664,1043.1680135455003C543.5762671891439,1057.3669219753162,556.1393794746989,1085.764738834948,573.4113518263794,1099.9636472647642C590.6833241780599,1114.16255569458,612.6641565958658,1114.16255569458,634.6449890136719,1114.16255569458C656.6258214314779,1114.16255569458,678.6066538492838,1114.16255569458,693.7637367248535,1114.16255569458C708.9208196004232,1114.16255569458,717.2541529337565,1114.16255569458,733.236234664917,1114.16255569458C749.2183163960775,1114.16255569458,772.8491465250651,1114.16255569458,796.4799766540527,1114.16255569458C820.1108067830404,1114.16255569458,843.741636912028,1114.16255569458,867.3049672444662,1114.16255569458C890.8682975769043,1114.16255569458,914.364128112793,1114.16255569458,937.8599586486816,1114.16255569458C961.3557891845703,1114.16255569458,984.851619720459,1114.16255569458,1000.76620165507,1114.16255569458C1016.680783589681,1114.16255569458,1025.0141169230144,1114.16255569458,1042.6212005615234,1077.2648345629375C1060.2282842000325,1040.3671134312947,1087.1091181437175,966.5716711680094,1100.5495351155598,929.6739500363668L1113.9899520874023,892.7762289047241" id="L-WEB4-NFS" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-WEB4 LE-NFS" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M65.66000366210938,656.4043407440186L69.82667032877605,656.4043407440186C73.9933369954427,656.4043407440186,82.32667032877605,656.4043407440186,90.66000366210938,656.4043407440186C98.9933369954427,656.4043407440186,107.32667032877605,656.4043407440186,115.66000366210938,656.4043407440186C123.9933369954427,656.4043407440186,132.32667032877603,656.4043407440186,136.49333699544272,656.4043407440186L140.66000366210938,656.4043407440186" id="L-U-I" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-U LE-I" style="fill:none;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default default" id="flowchart-ES1-77" transform="translate(1378.8112030029297, 62.739990234375)"><rect rx="19.739990234375" ry="19.739990234375" x="-59.178749084472656" y="-19.739990234375" width="118.35749816894531" height="39.47998046875"></rect><g class="label" style="" transform="translate(-46.743751525878906, -12.239990234375)"><foreignObject width="93.48750305175781" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Elasticsearch</span></div></foreignObject></g></g><g class="node default default" id="flowchart-ES2-78" transform="translate(1378.8112030029297, 152.219970703125)"><rect rx="19.739990234375" ry="19.739990234375" x="-59.178749084472656" y="-19.739990234375" width="118.35749816894531" height="39.47998046875"></rect><g class="label" style="" transform="translate(-46.743751525878906, -12.239990234375)"><foreignObject width="93.48750305175781" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Elasticsearch</span></div></foreignObject></g></g><g class="node default default" id="flowchart-ES3-79" transform="translate(1378.8112030029297, 241.699951171875)"><rect rx="19.739990234375" ry="19.739990234375" x="-59.178749084472656" y="-19.739990234375" width="118.35749816894531" height="39.47998046875"></rect><g class="label" style="" transform="translate(-46.743751525878906, -12.239990234375)"><foreignObject width="93.48750305175781" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Elasticsearch</span></div></foreignObject></g></g><g class="node default default" id="flowchart-A3-76" transform="translate(1113.9899520874023, 139.13685512542725)"><polygon points="51.07874298095703,0 102.15748596191406,-51.07874298095703 51.07874298095703,-102.15748596191406 0,-51.07874298095703" class="label-container" transform="translate(-51.07874298095703,51.07874298095703)"></polygon><g class="label" style="" transform="translate(-23.83875274658203, -12.239990234375)"><foreignObject width="47.67750549316406" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>output</span></div></foreignObject></g></g><g class="node default default" id="flowchart-A2-75" transform="translate(937.8599586486816, 139.13685512542725)"><polygon points="45.487491607666016,0 90.97498321533203,-45.487491607666016 45.487491607666016,-90.97498321533203 0,-45.487491607666016" class="label-container" transform="translate(-45.487491607666016,45.487491607666016)"></polygon><g class="label" style="" transform="translate(-18.247501373291016, -12.239990234375)"><foreignObject width="36.49500274658203" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>filter</span></div></foreignObject></g></g><g class="node default default" id="flowchart-A1-74" transform="translate(796.4799766540527, 139.13685512542725)"><polygon points="45.89249038696289,0 91.78498077392578,-45.89249038696289 45.89249038696289,-91.78498077392578 0,-45.89249038696289" class="label-container" transform="translate(-45.89249038696289,45.89249038696289)"></polygon><g class="label" style="" transform="translate(-18.65250015258789, -12.239990234375)"><foreignObject width="37.30500030517578" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>input</span></div></foreignObject></g></g><g class="node default S" id="flowchart-WS1-49" transform="translate(327.68499755859375, 468.2886896133423)"><rect rx="31.97998046875" ry="31.97998046875" x="-50.76374816894531" y="-31.97998046875" width="101.52749633789062" height="63.9599609375"></rect><g class="label" style="" transform="translate(-35.26875305175781, -24.47998046875)"><foreignObject width="70.53750610351562" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx-php<br>service</span></div></foreignObject></g></g><g class="node default S" id="flowchart-WS2-50" transform="translate(327.68499755859375, 839.5818176269531)"><rect rx="31.97998046875" ry="31.97998046875" x="-62.92499542236328" y="-31.97998046875" width="125.84999084472656" height="63.9599609375"></rect><g class="label" style="" transform="translate(-47.43000030517578, -24.47998046875)"><foreignObject width="94.86000061035156" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx-tomcat<br>service</span></div></foreignObject></g></g><g class="node default I" id="flowchart-I-51" transform="translate(177.71000289916992, 656.4043407440186)"><rect rx="19.739990234375" ry="19.739990234375" x="-37.04999923706055" y="-19.739990234375" width="74.0999984741211" height="39.47998046875"></rect><g class="label" style="" transform="translate(-24.615001678466797, -12.239990234375)"><foreignObject width="49.230003356933594" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>ingress</span></div></foreignObject></g></g><g class="node default S" id="flowchart-PS1-57" transform="translate(634.6449890136719, 584.4861860275269)"><rect rx="31.97998046875" ry="31.97998046875" x="-40.72874450683594" y="-31.97998046875" width="81.45748901367188" height="63.9599609375"></rect><g class="label" style="" transform="translate(-25.233749389648438, -24.47998046875)"><foreignObject width="50.467498779296875" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>php<br>service</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-WEB1-55" label-offset-y="7.452938661539635" transform="translate(517.1562423706055, 380.859317779541)"><path d="M 0,7.452938661539635 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 a 26.546249389648438,7.452938661539635 0,0,0 -53.092498779296875 0 l 0,46.93291913028963 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 l 0,-46.93291913028963" transform="translate(-26.546249389648438,-30.91939822668445)"></path><g class="label" style="" transform="translate(-19.046249389648438, -12.239990234375)"><foreignObject width="38.092498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-WEB2-56" label-offset-y="7.452938661539635" transform="translate(517.1562423706055, 595.5467653274536)"><path d="M 0,7.452938661539635 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 a 26.546249389648438,7.452938661539635 0,0,0 -53.092498779296875 0 l 0,46.93291913028963 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 l 0,-46.93291913028963" transform="translate(-26.546249389648438,-30.91939822668445)"></path><g class="label" style="" transform="translate(-19.046249389648438, -12.239990234375)"><foreignObject width="38.092498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx</span></div></foreignObject></g></g><g class="node default S" id="flowchart-PS2-61" transform="translate(634.6449890136719, 965.3033485412598)"><rect rx="31.97998046875" ry="31.97998046875" x="-40.94249725341797" y="-31.97998046875" width="81.88499450683594" height="63.9599609375"></rect><g class="label" style="" transform="translate(-25.44750213623047, -24.47998046875)"><foreignObject width="50.89500427246094" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>tomcat<br>service</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-WEB3-59" label-offset-y="7.452938661539635" transform="translate(517.1562423706055, 748.0549049377441)"><path d="M 0,7.452938661539635 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 a 26.546249389648438,7.452938661539635 0,0,0 -53.092498779296875 0 l 0,46.93291913028963 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 l 0,-46.93291913028963" transform="translate(-26.546249389648438,-30.91939822668445)"></path><g class="label" style="" transform="translate(-19.046249389648438, -12.239990234375)"><foreignObject width="38.092498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-WEB4-60" label-offset-y="7.452938661539635" transform="translate(517.1562423706055, 999.1456527709961)"><path d="M 0,7.452938661539635 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 a 26.546249389648438,7.452938661539635 0,0,0 -53.092498779296875 0 l 0,46.93291913028963 a 26.546249389648438,7.452938661539635 0,0,0 53.092498779296875 0 l 0,-46.93291913028963" transform="translate(-26.546249389648438,-30.91939822668445)"></path><g class="label" style="" transform="translate(-19.046249389648438, -12.239990234375)"><foreignObject width="38.092498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>nginx</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-PHP1-63" label-offset-y="6.435000155463744" transform="translate(937.8599586486816, 446.0924434661865)"><path d="M 0,6.435000155463744 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 a 21.66374969482422,6.435000155463744 0,0,0 -43.32749938964844 0 l 0,45.91498062421374 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 l 0,-45.91498062421374" transform="translate(-21.66374969482422,-29.392490467570614)"></path><g class="label" style="" transform="translate(-14.163749694824219, -12.239990234375)"><foreignObject width="28.327499389648438" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>PHP</span></div></foreignObject></g></g><g class="node default vPod" id="flowchart-PHP2-64" label-offset-y="6.435000155463744" transform="translate(937.8599586486816, 554.8774280548096)"><path d="M 0,6.435000155463744 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 a 21.66374969482422,6.435000155463744 0,0,0 -43.32749938964844 0 l 0,45.91498062421374 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 l 0,-45.91498062421374" transform="translate(-21.66374969482422,-29.392490467570614)"></path><g class="label" style="" transform="translate(-14.163749694824219, -12.239990234375)"><foreignObject width="28.327499389648438" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>PHP</span></div></foreignObject></g></g><g class="node default vPod" id="flowchart-PHP3-65" label-offset-y="6.435000155463744" transform="translate(937.8599586486816, 663.6624126434326)"><path d="M 0,6.435000155463744 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 a 21.66374969482422,6.435000155463744 0,0,0 -43.32749938964844 0 l 0,45.91498062421374 a 21.66374969482422,6.435000155463744 0,0,0 43.32749938964844 0 l 0,-45.91498062421374" transform="translate(-21.66374969482422,-29.392490467570614)"></path><g class="label" style="" transform="translate(-14.163749694824219, -12.239990234375)"><foreignObject width="28.327499389648438" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>PHP</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-TM1-67" label-offset-y="8.629744466545889" transform="translate(937.8599586486816, 815.7395133972168)"><path d="M 0,8.629744466545889 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 a 32.94750213623047,8.629744466545889 0,0,0 -65.89500427246094 0 l 0,48.10972493529589 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 l 0,-48.10972493529589" transform="translate(-32.94750213623047,-32.68460693419383)"></path><g class="label" style="" transform="translate(-25.44750213623047, -12.239990234375)"><foreignObject width="50.89500427246094" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>tomcat</span></div></foreignObject></g></g><g class="node default vPod" id="flowchart-TM2-68" label-offset-y="8.629744466545889" transform="translate(937.8599586486816, 931.1087303161621)"><path d="M 0,8.629744466545889 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 a 32.94750213623047,8.629744466545889 0,0,0 -65.89500427246094 0 l 0,48.10972493529589 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 l 0,-48.10972493529589" transform="translate(-32.94750213623047,-32.68460693419383)"></path><g class="label" style="" transform="translate(-25.44750213623047, -12.239990234375)"><foreignObject width="50.89500427246094" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>tomcat</span></div></foreignObject></g></g><g class="node default vPod" id="flowchart-TM3-69" label-offset-y="8.629744466545889" transform="translate(937.8599586486816, 1046.4779472351074)"><path d="M 0,8.629744466545889 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 a 32.94750213623047,8.629744466545889 0,0,0 -65.89500427246094 0 l 0,48.10972493529589 a 32.94750213623047,8.629744466545889 0,0,0 65.89500427246094 0 l 0,-48.10972493529589" transform="translate(-32.94750213623047,-32.68460693419383)"></path><g class="label" style="" transform="translate(-25.44750213623047, -12.239990234375)"><foreignObject width="50.89500427246094" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>tomcat</span></div></foreignObject></g></g><g class="node default default" id="flowchart-kk-84" label-offset-y="8.299041187190266" transform="translate(1544.0474548339844, 123.14935684204102)"><path d="M 0,8.299041187190266 a 31.05750274658203,8.299041187190266 0,0,0 62.11500549316406 0 a 31.05750274658203,8.299041187190266 0,0,0 -62.11500549316406 0 l 0,47.77902165594027 a 31.05750274658203,8.299041187190266 0,0,0 62.11500549316406 0 l 0,-47.77902165594027" transform="translate(-31.05750274658203,-32.1885520151604)"></path><g class="label" style="" transform="translate(-23.55750274658203, -12.239990234375)"><foreignObject width="47.11500549316406" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>kibana</span></div></foreignObject></g></g><g class="node default NFS" id="flowchart-NFS-95" transform="translate(1113.9899520874023, 892.7762289047241)"><polygon points="9.8699951171875,0 101.41500854492188,0 111.28500366210938,-19.739990234375 101.41500854492188,-39.47998046875 9.8699951171875,-39.47998046875 0,-19.739990234375" class="label-container" transform="translate(-55.64250183105469,19.739990234375)"></polygon><g class="label" style="" transform="translate(-38.27250671386719, -12.239990234375)"><foreignObject width="76.54501342773438" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>NFS Server</span></div></foreignObject></g></g><g class="node default User" id="flowchart-U-96" transform="translate(36.83000183105469, 656.4043407440186)"><circle rx="0" ry="0" r="28.830001831054688" width="57.660003662109375" height="39.47998046875"></circle><g class="label" style="" transform="translate(-21.330001831054688, -12.239990234375)"><foreignObject width="42.660003662109375" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Client</span></div></foreignObject></g></g></g></g></g></svg></div><h1><a name="二编写资源文件" class="md-header-anchor"></a><span>二、编写资源文件</span></h1><h4><a name="1创建nginxphpfilebeat容器" class="md-header-anchor"></a><span>1、创建nginx，php，filebeat容器</span></h4><p><span>使用test主机的nfs做共享存储卷</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用jumpserver管理资产，按p，查看资产，输入id <span class="cm-number">5</span>，进入资产</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@jumpserver ~]<span class="cm-comment"># ssh k8s@192.168.1.252 -p2222</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 46px;"></div><div class="CodeMirror-gutters" style="display: none; height: 46px;"></div></div></div></pre><p><img src="images/image-20220904160012855.png" referrerpolicy="no-referrer" alt="image-20220904160012855"></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded md-focus" lang="yaml" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap CodeMirror-focused" lang="yaml"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 3712.5px; left: 42.8819px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre>x</pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>k8s@test ~<span class="cm-meta">]</span>$ sudo -s</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test k8s<span class="cm-meta">]</span># yum -y install nfs-utils</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#nginx的共享网页目录</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test k8s<span class="cm-meta">]</span># mkdir -m 777 /var/nginxphp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#tomcat的共享目录</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test k8s<span class="cm-meta">]</span># mkdir -m 777 /var/nginxtomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test k8s<span class="cm-meta">]</span># vim /etc/exports</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">/var/nginxphp  *(rw)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">/var/nginxtomcat  *(rw)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test ks8<span class="cm-meta">]</span># systemctl enable --now nfs</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test ks8<span class="cm-meta">]</span># cd /var/nginxphp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test nginxphp<span class="cm-meta">]</span># scp  192.168.1.252:/root/5/public/info.php ./ <span class="cm-comment">#拷贝nginx的动态页面</span></span></pre><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test nginphp<span class="cm-meta">]</span># echo hello world &gt; info.html<span class="cm-tab" role="presentation" cm-text="	">   </span> &nbsp; &nbsp;<span class="cm-comment">#创建nginx静态页面</span></span></pre></div><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test nginxphp<span class="cm-meta">]</span># vim /var/nginxtomcat/test.jsp &nbsp; &nbsp; <span class="cm-comment">#编写tomcat的共享文件</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;html&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;body&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;center&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">Now time is</span><span class="cm-meta">: </span>&lt;%=new java.util.Date()%&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;/center&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;/body&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">&lt;/html&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@test nginxphp<span class="cm-meta">]</span># exit</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">exit</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>k8s@test ~<span class="cm-meta">]</span>$ exit</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">logout</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>Host<span class="cm-meta">]</span>&gt; exit</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">jumpserver主机创建pv和pvc的资源，共享网页资源</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ~<span class="cm-meta">]</span># mkdir nginx;cd nginx/</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim pv-nfs.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>PersistentVolume</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>pv-nfs</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  volumeMode</span><span class="cm-meta">: </span>Filesystem</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  capacity</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  storage</span><span class="cm-meta">: </span>30Gi</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  accessModes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadWriteMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadOnlyMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadWriteOnce</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  persistentVolumeReclaimPolicy</span><span class="cm-meta">: </span>Retain</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  nfs</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  path</span><span class="cm-meta">: </span>/var/nginxphp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  server</span><span class="cm-meta">: </span><span class="cm-number">192.168.1.101</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim pvc-nfs.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>PersistentVolumeClaim</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>pvc-nfs</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  volumeMode</span><span class="cm-meta">: </span>Filesystem</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  accessModes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp;  - </span>ReadWriteMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  resources</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  requests</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  storage</span><span class="cm-meta">: </span>25Gi</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginx加载pvc,使用nfs共享目录</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim nginx-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  matchLabels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  replicas</span><span class="cm-meta">: </span><span class="cm-number">1</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  template</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  labels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  volumes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加pvc</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  persistentVolumeClaim</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  claimName</span><span class="cm-meta">: </span>pvc-nfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加，应用pvc</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/html &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加，指定目录</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">php加载pvc,使用nfs共享目录</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim php-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  matchLabels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  replicas</span><span class="cm-meta">: </span><span class="cm-number">1</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  template</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  labels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  spec</span><span class="cm-meta">: </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  volumes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  persistentVolumeClaim</span><span class="cm-meta">: &nbsp; </span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  claimName</span><span class="cm-meta">: </span>pvc-nfs &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>phpfpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span><span class="cm-number">9000</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/html &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">让nginx和php连接，编写php-service.yaml文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim php-service.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>phpfpm-service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  port</span><span class="cm-meta">: </span><span class="cm-number">9000</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  targetPort</span><span class="cm-meta">: </span><span class="cm-number">9000</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  app</span><span class="cm-meta">: </span>php-fpm &nbsp; &nbsp; <span class="cm-comment">#需要和php-deployment.yaml里面labels里面定义的一致</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  type</span><span class="cm-meta">: </span>ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用configmap映射nginx配置文件，实现动静分离</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># yum -y install docker-ce</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim /etc/hosts</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">192.168.1.100 harbor</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim /etc/docker/daemon.json</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">{</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-string">"insecure-registries"</span>:<span class="cm-meta">[</span><span class="cm-string">"harbor:80"</span><span class="cm-meta">]</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">}</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># systemctl restart docker</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker run -itd --name nginx harbor:80/library/myos:nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker cp nginx:/usr/local/nginx/conf/nginx.conf ./</span></pre><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim nginx.conf<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#21,22,23,25去掉注释</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 21 &nbsp; &nbsp; log_format  main &nbsp;<span class="cm-string">'$http_x_forwarded_for - $remote_user [$time_local] "$request" '</span> &nbsp; &nbsp;<span class="cm-comment">#更改</span></span></pre><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 22 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-string">'$status $body_bytes_sent "$http_referer" '</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 23 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-string">'"$http_user_agent"'</span>;<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#更改</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 24 </span></pre><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> 25 &nbsp; &nbsp; access_log  logs/access.log  main;<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> ...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 65 &nbsp; &nbsp; &nbsp; &nbsp; location ~ \.php$ <span class="cm-meta">{</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 66 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 67 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_pass &nbsp; phpfpm-service:9000;<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#更改</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 68 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_index  index.php;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 69 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp;  fastcgi.conf; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#更改</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 70 &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-meta">}</span> &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用configmap进行映射nginx配置文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl create configmap nginx-conf --from-file=nginx.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl get configmaps</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">让nginx加载ConfigMap</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim nginx-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加confgiMap</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  configMap</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>nginx-conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/html &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#引用configMap</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/conf/nginx.conf &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>nginx.conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">更改php配置文件，能够监听所有端口，解析php代码</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker run -itd --name myphp harbor:80/library/myos:phpfpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker cp myphp:/etc/php-fpm.d/www.conf ./</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim www.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">12 listen = 0.0.0.0:9000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#监听所有。可与访问该服务器的客户端进行通信</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">24 ; listen.allowed_clients = 127.0.0.1 &nbsp; &nbsp;<span class="cm-comment">#允许其他地址连接访问</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建configmap，进行映射php-fpm配置文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl create configmap php --from-file=www.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim php-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>php-conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  configMap</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>phpfpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span><span class="cm-number">9000</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/html &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>php-conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/etc/php-fpm.d/www.conf &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>www.conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">编写filebeat的configMap配置，使其和nginx共享日志</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker run -itd --name filebeat harbor:80/library/myos:filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># docker cp filebeat:/etc/filebeat/filebeat.yml ./</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">修改filebeat的配置文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim filebeat.yml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> 24 &nbsp; enabled</span><span class="cm-meta">: </span>true<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#打开收集模块</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 28 &nbsp; &nbsp; - /var/weblog/access.log<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#指定filebeat读取的日志文件</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> 45 &nbsp; fields</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> 46 &nbsp; &nbsp; my_type</span><span class="cm-meta">: </span>nginx_log<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#新添加自定义标签</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> 149 <span class="cm-comment">#output.elasticsearch:<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#加上注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> 151 &nbsp; <span class="cm-comment">#hosts: ["localhost:9200"]<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span> #加上注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">162 output.logstash</span><span class="cm-meta">:<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span></span><span class="cm-comment">#去掉注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">164 &nbsp; hosts</span><span class="cm-meta">: [</span><span class="cm-string">"192.168.1.75:5044"</span><span class="cm-meta">]</span><span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span> <span class="cm-comment">#指定logstash主机IP地址</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">180 <span class="cm-comment">#processors:<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#加上注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">181 &nbsp; <span class="cm-comment">#- add_host_metadata: ~<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> #加上注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">182 &nbsp; <span class="cm-comment">#- add_cloud_metadata: ~<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> #加上注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl create configmap filebeat --from-file=filebeat.yml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">编写nginx-deployment.yaml资源清单文件，把filebeat和nginx放到同一个pod中，收集nginx日志，到elk可以进行分析</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim nginx-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>filebeat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  configMap</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>filebeat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  hostPath</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  path</span><span class="cm-meta">: </span>/var/weblog &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  type</span><span class="cm-meta">: </span>DirectoryOrCreate &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/html &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/conf/nginx.conf &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>nginx.conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/logs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>filebeat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>filebeat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>filebeat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/etc/filebeat/filebeat.yml &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>filebeat.yml &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/var/weblog &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">编写nginx的service服务文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim nginx-service.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>nginx-service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  port</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  targetPort</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  app</span><span class="cm-meta">: </span>nginx &nbsp; &nbsp; <span class="cm-comment">#需要和nginx-deployment.yaml里面labels里面定义的一致</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  type</span><span class="cm-meta">: </span>ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">执行上面创建的资源文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f pv-nfs.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f pvc-nfs.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f nginx-service.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f nginx-deployment.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f php-service.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f php-deployment.yaml</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 6875px;"></div><div class="CodeMirror-gutters" style="display: none; height: 6875px;"></div></div></div></pre><h1><a name="三动态集群hpa搭建" class="md-header-anchor"></a><span>三、动态集群HPA搭建</span></h1><h4><a name="1安装metrics-server插件" class="md-header-anchor"></a><span>1、安装metrics-server插件</span></h4><p><img src="images/image-20220803140145243.png" referrerpolicy="no-referrer" alt="image-20220803140145243"></p><p><img src="images/image-20220803140257690.png" referrerpolicy="no-referrer" alt="image-20220803140257690"></p><p><img src="images/image-20220803140325961.png" referrerpolicy="no-referrer" alt="image-20220803140325961"></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="yaml" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="yaml"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">安装完成之后，稍等片刻，可以看到资源信息 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl top node</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp;  CPU(cores) &nbsp; CPU% &nbsp; MEMORY(bytes) &nbsp; MEMORY% &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">192.168.1.2 &nbsp; 80m &nbsp; &nbsp; &nbsp; &nbsp;  4% &nbsp; &nbsp; 1727Mi &nbsp; &nbsp; &nbsp; &nbsp;  79% &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">192.168.1.3 &nbsp; 80m &nbsp; &nbsp; &nbsp; &nbsp;  4% &nbsp; &nbsp; 1758Mi &nbsp; &nbsp; &nbsp; &nbsp;  81% &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">192.168.1.4 &nbsp; 103m &nbsp; &nbsp; &nbsp; &nbsp; 5% &nbsp; &nbsp; 1736Mi &nbsp; &nbsp; &nbsp; &nbsp;  80% &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl top pod</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  CPU(cores) &nbsp; MEMORY(bytes) &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginx-7fc8cd6d6c-wkhfd &nbsp;  1m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7Mi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">php-fpm-9f4b9486f-ds7cg &nbsp; 1m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4Mi </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">更改php的资源文件，实现HPA弹性集群自动伸缩，在php-deployment.yaml添加配额</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim php-deployment.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>php-conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/etc/php-fpm.d/www.conf &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>www.conf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  resources</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  requests</span><span class="cm-meta">: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cpu</span><span class="cm-meta">: </span>200m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">hpa实现弹性伸缩</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># vim hpa.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>autoscaling/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>HorizontalPodAutoscaler</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>nginxphp-backend</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  minReplicas</span><span class="cm-meta">: </span><span class="cm-number">1</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  maxReplicas</span><span class="cm-meta">: </span><span class="cm-number">3</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  scaleTargetRef</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  name</span><span class="cm-meta">: </span>php-fpm</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  targetCPUUtilizationPercentage</span><span class="cm-meta">: </span><span class="cm-number">50 </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f php-deployment.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl apply -f hpa.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># kubectl get hpa<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#刚开始可能是unknown，等一会就会正常</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REFERENCE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TARGETS &nbsp; MINPODS &nbsp; MAXPODS &nbsp; REPLICAS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginxphp-backend &nbsp; Deployment/php-fpm &nbsp; 0%/50% &nbsp;  1 &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp;  15s</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 985px;"></div><div class="CodeMirror-gutters" style="display: none; height: 985px;"></div></div></div></pre><h4><a name="2nginxtomcat配置" class="md-header-anchor"></a><span>2、nginx+tomcat配置</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="yaml" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="yaml"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginx+tomcat配置和php差不多，需要注意如何配置代理，网页在前面已经写好</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建tomcat的pv 和 pvc使用的资源</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># mkdir /root/tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver nginx<span class="cm-meta">]</span># cd /root/tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim pv-tomcat.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>PersistentVolume</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>pv-tomcat<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#名字</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  volumeMode</span><span class="cm-meta">: </span>Filesystem</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  capacity</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  storage</span><span class="cm-meta">: </span>5Gi<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#可以提供的空间</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  accessModes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadWriteMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadOnlyMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span>ReadWriteOnce</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  persistentVolumeReclaimPolicy</span><span class="cm-meta">: </span>Retain</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  nfs</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  path</span><span class="cm-meta">: </span>/var/nginxtomcat/<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#指定tomcat的共享目录，之前已经创建</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  server</span><span class="cm-meta">: </span><span class="cm-number">192.168.1.101</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim pvc-tomcat.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>PersistentVolumeClaim</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>pvc-tomcat<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#名称</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  volumeMode</span><span class="cm-meta">: </span>Filesystem</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  accessModes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp;  - </span>ReadWriteMany</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  resources</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  requests</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  storage</span><span class="cm-meta">: </span>2Gi<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#需要的空间</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">编写关于nginx+tomcat转发的配置文件，配置nginx的ConfigMap，更改日志格式 和 nginx转发规则</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># docker run -itd --name mynginx harbor:80/library/myos:nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># docker cp mynginx:/usr/local/nginx/conf/nginx.conf ./</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim nginx.conf </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 21 &nbsp; &nbsp; log_format  main &nbsp;<span class="cm-string">'$http_x_forwarded_for - $remote_user [$time_local] "$request" '</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 22 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-string">'$status $body_bytes_sent "$http_referer" '</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 23 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-string">'"$http_user_agent"'</span>;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 24 </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 25 &nbsp; &nbsp; access_log  logs/access.log  main;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 35 &nbsp; &nbsp; server <span class="cm-meta">{</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 36 &nbsp; &nbsp; &nbsp; &nbsp; listen &nbsp; &nbsp; &nbsp; 80;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 37 &nbsp; &nbsp; &nbsp; &nbsp; server_name  nginx-tomcat;<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-comment">#更改此参数为nginx-service的名字</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 43 &nbsp; &nbsp; &nbsp; &nbsp; location / <span class="cm-meta">{</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 44 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; html;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 45 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index  index.html index.htm;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 46 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass http://tomcat-service:8080;<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-comment">#新添加参数，转发后端的tomcat-service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> 47 &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-meta">}</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">...</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">制作名为nginx-tomcat的configMap</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl create configmap nginx-tomcat --from-file=nginx.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># cp /root/nginx/filebeat.yml ./</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl create configmap tomcat-filebeat --from-file=filebeat.yml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建nginx的资源文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim nginx.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  matchLabels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  replicas</span><span class="cm-meta">: </span>1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  template</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  labels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  volumes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  configMap</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>tomcat-filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  configMap</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>tomcat-filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  hostPath</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  path</span><span class="cm-meta">: </span>/var/weblog</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  type</span><span class="cm-meta">: </span>DirectoryOrCreate</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>nginx</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/conf/nginx.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>nginx.conf</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/nginx/logs/</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span>80</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>nginx-tomcat-filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>tomcat-filebeat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/etc/filebeat/filebeat.yml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  subPath</span><span class="cm-meta">: </span>filebeat.yml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>log-data</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/var/weblog</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#定义容器的重启方式</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建tomcat的资源文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim tomcat.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  matchLabels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  replicas</span><span class="cm-meta">: </span>1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  template</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  labels</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  app</span><span class="cm-meta">: </span>tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  volumes</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  persistentVolumeClaim</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  claimName</span><span class="cm-meta">: </span>pvc-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  containers</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/myos<span class="cm-meta">:</span>tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  volumeMounts</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">name</span><span class="cm-meta">: </span>web-site</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  mountPath</span><span class="cm-meta">: </span>/usr/local/apache-tomcat-9.0.6/webapps/ROOT</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp; &nbsp;  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  containerPort</span><span class="cm-meta">: </span>8080</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  resources</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  requests</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cpu</span><span class="cm-meta">: </span>200m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  restartPolicy</span><span class="cm-meta">: </span>Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建连接tomcat服务的service资源文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim tomcat-svr.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>tomcat-service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  port</span><span class="cm-meta">: </span>8080</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  targetPort</span><span class="cm-meta">: </span>8080</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  app</span><span class="cm-meta">: </span>tomcat &nbsp; &nbsp; <span class="cm-comment">#需要和tomcat.yaml里面labels里面定义的一致</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  type</span><span class="cm-meta">: </span>ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建连接nginx服务的service文件</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim nginx-svr.yaml</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  ports</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">protocol</span><span class="cm-meta">: </span>TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  port</span><span class="cm-meta">: </span>80</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  targetPort</span><span class="cm-meta">: </span>80</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  selector</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  app</span><span class="cm-meta">: </span>nginx-tomcat &nbsp; &nbsp; <span class="cm-comment">#需要和nginx.yaml里面labels里面定义的一致</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  type</span><span class="cm-meta">: </span>ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">创建hpa资源</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># vim hpa.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>autoscaling/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>HorizontalPodAutoscaler</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>tomcat-backend</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  minReplicas</span><span class="cm-meta">: </span>1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  maxReplicas</span><span class="cm-meta">: </span>3</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  scaleTargetRef</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  apiVersion</span><span class="cm-meta">: </span>apps/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  kind</span><span class="cm-meta">: </span>Deployment</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  name</span><span class="cm-meta">: </span>tomcat<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#新更改tomcat资源的名字</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  targetCPUUtilizationPercentage</span><span class="cm-meta">: </span>50</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f pv-tomcat.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f pvc-tomcat.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f tomcat.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f tomcat-svr.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f nginx.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f nginx-svr.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># kubectl apply -f hpa.yaml </span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 4698px;"></div><div class="CodeMirror-gutters" style="display: none; height: 4698px;"></div></div></div></pre><h1><a name="四ingress发布服务" class="md-header-anchor"></a><span>四、ingress发布服务</span></h1><h4><a name="1配置ingress服务" class="md-header-anchor"></a><span>1、配置ingress服务</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="yaml" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="yaml"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">打标签并上传ingress相关镜像</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker login harbor:80<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#登录harbor</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">Username</span><span class="cm-meta">: </span>admin<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#用户名admin</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">Password</span><span class="cm-meta">: <span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span></span><span class="cm-comment">#密码Harbor12345</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver tomcat<span class="cm-meta">]</span># cd /root/5/kubernetes/plugins/ingress</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker load  -i ingress.tar.xz</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker tag k8s.gcr.io/ingress-nginx/controller:v1.1.0 harbor:80/library/controller:v1.1.0</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker push harbor:80/library/controller:v1.1.0</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker tag k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1 harbor:80/library/kube-webhook-certgen:v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># docker push harbor:80/library/kube-webhook-certgen:v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># vim deploy.yaml <span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#更改文件</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">328 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/controller<span class="cm-meta">:</span>v1.1.0</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">609 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/kube-webhook-certgen<span class="cm-meta">:</span>v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">661 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image</span><span class="cm-meta">: </span>harbor<span class="cm-meta">:</span>80/library/kube-webhook-certgen<span class="cm-meta">:</span>v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># kubectl apply -f deploy.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># vim example.yaml <span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#设置访问策略</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">apiVersion</span><span class="cm-meta">: </span>networking.k8s.io/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">kind</span><span class="cm-meta">: </span>Ingress</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">metadata</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  name</span><span class="cm-meta">: </span>myweb</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">#namespace: ing-internal<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> &nbsp;<span class="cm-comment">#annotations:<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">#nginx.ingress.kubernetes.io/rewrite-target: /<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-comment">#kubernetes.io/ingress.class: "nginx"<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#注释</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">spec</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  ingressClassName</span><span class="cm-meta">: </span>nginx &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#新添加，使用的类名称，使用的控制器是哪个</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">  rules</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">host</span><span class="cm-meta">: </span>foo.bar.com<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#使用域名访问</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  http</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  paths</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">path</span><span class="cm-meta">: </span>/</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  pathType</span><span class="cm-meta">: </span>Prefix</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  backend</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  service</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>nginx-service<span class="cm-tab" role="presentation" cm-text="	"> </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  port</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  number</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">  - </span><span class="cm-atom">host</span><span class="cm-meta">: </span>bar.foo.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#使用域名访问</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp;  http</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp;  paths</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta"> &nbsp; &nbsp;  - </span><span class="cm-atom">path</span><span class="cm-meta">: </span>/</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  pathType</span><span class="cm-meta">: </span>Prefix</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp;  backend</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp;  service</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  name</span><span class="cm-meta">: </span>nginx-tomcat</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  port</span><span class="cm-meta">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  number</span><span class="cm-meta">: </span><span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># kubectl apply -f example.yaml </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># kubectl get  ingress<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-comment">#可以看到服务发布到1.4</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp;  CLASS &nbsp; HOSTS &nbsp; &nbsp; &nbsp;  <span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> ADDRESS &nbsp; &nbsp; &nbsp; PORTS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">myweb &nbsp; nginx &nbsp; foo.bar.com bar.foo.com &nbsp; 192.168.1.4 &nbsp; 80 &nbsp; &nbsp;  15s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># vim /etc/hosts</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">192.168.1.4 foo.bar.com bar.foo.com<span class="cm-tab" role="presentation" cm-text="	"> </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-comment">#ip地址为ingress发布的地址</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># curl foo.bar.com/info.php</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># curl bar.foo.com/test.jsp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-atom">若Linux没有写hosts文件，需要命令行访问可以curl -H "HOST</span><span class="cm-meta">: </span>foo.bar.com<span class="cm-string">" http://192.168.1.4/info.php</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 1490px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1490px;"></div></div></div></pre><p><span>使用ELB发布ingress，配置监听器,监听80端口，选中获取客户端ip，配置后端服务</span></p><p><img src="images/image-20220810105112337.png" referrerpolicy="no-referrer" alt="image-20220810105112337"></p><p><img src="images/image-20230629015837907.png" referrerpolicy="no-referrer" alt="image-20230629015837907"></p><p>&nbsp;</p><p><img src="images/image-20220810105230711.png" referrerpolicy="no-referrer" alt="image-20220810105230711"></p><p><img src="images/image-20230629015955022.png" referrerpolicy="no-referrer" alt="image-20230629015955022"></p><p><span>192.168.1.4为ingress发布的机器</span></p><p><img src="images/image-20230629020036807.png" referrerpolicy="no-referrer" alt="image-20230629020036807"></p><p><span>点击提交</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="yaml"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="yaml"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">通过域名访问</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">1、在windows上面更改hosts文件，浏览器访问：公网ip + 域名 即可实现使用域名访问网站</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">2、在linux真机上面更改hosts文件，浏览器访问：公网ip + 域名 即可实现使用域名访问网站</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">测试弹性集群</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># ab -c 1000 -n 10000 foo.bar.com/info.php</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span># ab -c 1000 -n 10000 bar.foo.com/test.jsp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-meta">[</span>root@jumpserver ingress<span class="cm-meta">]</span>#  kubectl get hpa -w<span class="cm-tab" role="presentation" cm-text="	">  </span><span class="cm-comment">#可以看到结果</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp;  REFERENCE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TARGETS &nbsp; MINPODS &nbsp; MAXPODS &nbsp; REPLICAS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginxphp-backend &nbsp; Deployment/php-backend &nbsp; 0%/50% &nbsp;  1 &nbsp;  3 &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp;  16m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginxphp-backend &nbsp; Deployment/php-backend &nbsp; 231%/50%  1 &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp;  19m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">tomcat-backend &nbsp; &nbsp; Deployment/php-backend &nbsp; &nbsp; 1%/50% &nbsp;  1 &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp;  20m</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 298px;"></div><div class="CodeMirror-gutters" style="display: none; height: 298px;"></div></div></div></pre><h1><a name="五收集日志" class="md-header-anchor"></a><span>五、收集日志</span></h1><h4><a name="1把数据写入到es集群" class="md-header-anchor"></a><span>1、把数据写入到ES集群</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">通过堡垒机管理</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@jumpserver ~]<span class="cm-comment"># ssh elk@192.168.1.252 -p2222</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 46px;"></div><div class="CodeMirror-gutters" style="display: none; height: 46px;"></div></div></div></pre><p><img src="images/image-20220904181930480.png" referrerpolicy="no-referrer" alt="image-20220904181930480"></p><p><img src="images/image-20220904181957963.png" referrerpolicy="no-referrer" alt="image-20220904181957963"></p><p>&nbsp;</p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">安装logstash服务1.75</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[elk@logstash ~]<span class="cm-def">$ sudo</span> <span class="cm-attribute">-s</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@logstash elk]<span class="cm-comment"># vim /etc/hosts</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.1.71 es-0001</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.1.72 es-0002</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.1.73 es-0003</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.1.75 logstash</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@logstash elk]<span class="cm-comment"># yum -y install java-1.8.0-openjdk logstash</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@logstash elk]<span class="cm-comment"># ln -s /etc/logstash /usr/share/logstash/config  #logstash安装时配置在 /usr/share/logstash/，但是红帽安装时配置放到了/etc/，需要做个软连接到/usr/share/logstash/config，不然logstash找不到配置文件</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">配置logstash</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@logstash elk]<span class="cm-comment"># vim /etc/logstash/conf.d/my.conf </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">input{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> stdin{ codec <span class="cm-operator">=</span>&gt; <span class="cm-string">"json"</span> }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> beats{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  port <span class="cm-operator">=</span>&gt; <span class="cm-number">5044</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">filter{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">if</span> [fields][my_type] <span class="cm-operator">==</span> <span class="cm-string">"nginx_log"</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  grok {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  match <span class="cm-operator">=</span>&gt; { <span class="cm-string">"message"</span> <span class="cm-operator">=</span>&gt; <span class="cm-string">"%{HTTPD_COMBINEDLOG}"</span> }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">output{</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  stdout{ codec <span class="cm-operator">=</span>&gt; <span class="cm-string">"rubydebug"</span> }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">if</span> [fields][my_type] <span class="cm-operator">==</span> <span class="cm-string">"nginx_log"</span> {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  elasticsearch {</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  hosts <span class="cm-operator">=</span>&gt; [<span class="cm-string">"es-0001:9200"</span>, <span class="cm-string">"es-0002:9200"</span>]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  index <span class="cm-operator">=</span>&gt; <span class="cm-string">"nginx_log-%{+YYYY.MM.dd}"</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> }</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">}</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@logstash elk]<span class="cm-comment"># /usr/share/logstash/bin/logstash</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 848px;"></div><div class="CodeMirror-gutters" style="display: none; height: 848px;"></div></div></div></pre><p><span>访问从ELB发布的ingress，</span><a href='http://foo.bar.com/info.php' target='_blank' class='url'>http://foo.bar.com/info.php</a><span>或者 </span><a href='http://bar.foo.com/test.jsp' target='_blank' class='url'>http://bar.foo.com/test.jsp</a><span>，可以看到数据</span></p><p><img src="images/image-20220806173711931.png" referrerpolicy="no-referrer" alt="image-20220806173711931"></p><h1><a name="六kibana数据展示" class="md-header-anchor"></a><span>六、kibana数据展示</span></h1><h4><a name="1数据展示" class="md-header-anchor"></a><span>1、数据展示</span></h4><p><span>使用kibana 导入索引数据，绘制图形,可以采用通配符</span></p><p><img src="images/image-20230629020906370.png" referrerpolicy="no-referrer" alt="image-20230629020906370"></p><p><span>时间字段选择@timestamp</span></p><p><img src="images/image-20220810110951301.png" referrerpolicy="no-referrer" alt="image-20220810110951301"></p><p><span>将前面案例收集的数据，进行可视化展示，单击Discover,可以看到数据</span></p><p><img src="images/image-20220810111004029.png" referrerpolicy="no-referrer" alt="image-20220810111004029"></p><p><span>以表格的形式进行展示，同时可选择什么时间段内的数据，以及数据刷新时间</span></p><p><img src="images/image-20220810111016868.png" referrerpolicy="no-referrer" alt="image-20220810111016868"></p><p>&nbsp;</p><p><span>创建可视化图表</span></p><p><img src="images/image-20220810111027179.png" referrerpolicy="no-referrer" alt="image-20220810111027179"></p><p><img src="images/image-20220810111038427.png" referrerpolicy="no-referrer" alt="image-20220810111038427"></p><p>&nbsp;</p><p><img src="images/image-20220810111054415.png" referrerpolicy="no-referrer" alt="image-20220810111054415"></p><p>&nbsp;</p><p><img src="images/image-20220810111119947.png" referrerpolicy="no-referrer" alt="image-20220810111119947"></p><p>&nbsp;</p><p><span>点击Dashbard，会有很多仪表板。在搜索框里写入关键词host，会出现和搜索关键词相关的仪表板。可以通过它进行数据展示</span></p><p><img src="images/image-20220810111133164.png" referrerpolicy="no-referrer" alt="image-20220810111133164"></p><p><span> 点击添加</span></p><p><img src="images/image-20220810111148051.png" referrerpolicy="no-referrer" alt="image-20220810111148051"></p><p><img src="images/image-20220810111159427.png" referrerpolicy="no-referrer" alt="image-20220810111159427"></p><p><span>保存仪表板</span></p><p><img src="images/image-20220810111209532.png" referrerpolicy="no-referrer" alt="image-20220810111209532"></p><p><img src="images/image-20220810111218788.png" referrerpolicy="no-referrer" alt="image-20220810111218788"></p><p><span>访问网站页面，可以看到结果输出</span></p><p><img src="images/image-20220810111229600.png" referrerpolicy="no-referrer" alt="image-20220810111229600"></p></div>
</body>
</html>